<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML>
<html>
<head>
<title>39 | 我的待办</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="application/x-javascript">
	
	 addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } 

</script>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- Graph CSS -->
<link href="css/lines.css" rel='stylesheet' type='text/css' />
<link href="css/font-awesome.css" rel="stylesheet">
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<!-- Nav CSS -->
<link href="css/custom.css" rel="stylesheet">
<!-- Metis Menu Plugin JavaScript -->
<script src="js/metisMenu.min.js"></script>
<script src="js/custom.js"></script>
<!-- Graph JavaScript -->
<script src="js/d3.v3.js"></script>
<script src="js/rickshaw.js"></script>
<script>
	function getNodeDetail(id) {
		var newWindow = null;
		if (newWindow == null || newWindow.closed) {
			openUrl = "nodeDetail?opcode=success&node_id=" + id;
			var width = 900;
			var height = 690;
			var left = parseInt((screen.availWidth / 2) - (width / 2));
			var top = parseInt((screen.availHeight / 2) - (height / 2));
			var windowFeatures = "width="
					+ width
					+ ",height="
					+ height
					+ ",status=no,resizable=0,scrollbars=0,titlebar=0,toolbar=0,location=no,menubar=0,left="
					+ left + ",top=" + top + "screenX=" + left + ",screenY="
					+ top;
			newWindow = window.open(openUrl, "node_update_subWind",
					windowFeatures);
		} else {
			newWindow.focus();
		}
	}
</script>
</head>
<body>
	<div id="">
		<!-- left.jsp -->
		<jsp:include page="left.jsp"></jsp:include>
		<div id="page-wrapper">
			<div class="xs">
				<div class="well1 white">
					<h1 align="center">项目列表</h1>
					<h2>待审批项目</h2>
					<c:choose>
						<c:when
							test="${projectList == null or fn:length(projectList) == 0 }">
							<p style="color:red;" align="center">当前没有需要审批的项目</p>
							<br>
						</c:when>
						<c:otherwise>
							<p style="color:red;">以下项目的信息被修改，需要审批</p>
							<table class="table">
								<thead>
									<tr align="center">
										<th>项目令号</th>
										<th>项目名称</th>
										<th>主管所领导</th>
										<th>项目领域</th>
										<th>项目类型</th>
										<th>信息修改</th>
										<th>状态管理</th>
										<th>项目资料</th>
										<th>运行记录</th>
										<th>查看详情</th>
									</tr>
								</thead>
								<tbody>


									<c:forEach items="${projectList }" var="p">
										<tr align="left">
											<td>${p.project_code }</td>
											<td>${p.project_name}</td>
											<td>${p.leader_39.user_name }</td>
											<td>${p.project_filed.projectfield_name }</td>
											<td>${p.project_type.protype_name }</td>
											<td><a href="projectInfoUpdate?project_id=${p.id }">进入</a>
											</td>
											<td><a href="projectStatusUpdate?project_id=${p.id }">
													<c:if test="${sessionScope.user.role.id == 2 }">进入</c:if> <c:if
														test="${sessionScope.user.role.id == 3 }">审批</c:if> </a></td>
											<td><a href="#">进入</a></td>
											<td><a href="#">进入</a></td>
											<td><a href="getProjectInfo?id=${p.id }&opcode=0">查看详情</a>
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</c:otherwise>
					</c:choose>


					<h2>待审批一级计划</h2>
					<c:choose>
						<c:when
							test="${firstplanList == null or fn:length(firstplanList) == 0 }">
							<p style="color:red;" align="center">当前没有发布一级计划</p>
							<br>
						</c:when>
						<c:otherwise>
							<p style="color:red;">以下项目的一级计划被发布，需要审批</p>
							<table class="table">
								<tr>
									<th>项目令号</th>
									<th>项目名称</th>
									<th>操作</th>
								</tr>
								<c:forEach items="${firstplanList }" var="fp">
									<tr>
										<td>${fp.project.project_code }</td>
										<td>${fp.project.project_name}</td>
										<td><c:if test="${sessionScope.user.role.id == 2 }">等待审核</c:if>
											<c:if test="${sessionScope.user.role.id == 3 }">
												<a href="access_plan?project_id=${fp.project.id }">审批</a>
											</c:if>
										</td>
									</tr>
								</c:forEach>
							</table>
						</c:otherwise>
					</c:choose>


					<%-- <h2>待审批的节点</h2>
					<c:choose>
						<c:when test="${reviewdplanList == null or fn:length(reviewdplanList) == 0 }">
							<p style="color:red;" align="center">当前没有需要审核的节点</p><br>
						</c:when>
						<c:otherwise>
							<p style="color:red;">以下项目的一级计划中，存在待审批节点</p>
							<table class="table">
								<tr>
									<th>项目令号</th>
									<th>项目名称</th>
									<th>操作</th>
								</tr>
								<c:forEach items="${reviewdplanList }" var="fp">
									<tr>
										<td>${fp.project.project_code }</td>
										<td>${fp.project.project_name}</td>
										<td><a href="#">
											<c:if test="${sessionScope.user.role.id == 2 }"><a href="findPlanById?opcode=forDetail&id=${fp.id}">进入</a></c:if>
											<c:if test="${sessionScope.user.role.id == 3 }">
												<a href="findPlanById?opcode=forDetail&id=${fp.id}">审批</a>
											</c:if>
										</a></td>
									</tr>
								</c:forEach>
							</table>
						</c:otherwise>
					</c:choose> --%>


					<h2>待审批的节点</h2>
					<c:choose>
						<c:when test="${nodeList == null or fn:length(nodeList) == 0 }">
							<p style="color:red;" align="center">当前没有需要审核的节点</p>
							<br>
						</c:when>
						<c:otherwise>
							<table class="table">
								<tr>
									<th>节点编号</th>
									<th>责任部门</th>
									<th>节点状态</th>
									<th>节点描述</th>
									<th>节点开始时间</th>
									<th>节点结束时间</th>
									<th>节点版本</th>
									<th>操作</th>
								</tr>
								<c:forEach items="${nodeList }" var="node">
									<c:if
										test="${sessionScope.user.role.id == 2 and node.firstplan.project.cpd_ps.id == sessionScope.user.id and node.updateornot == 0} ">
										<tr>
											<td>${node.node_id }</td>
											<td>${node.department.dept_name }</td>
											<td><c:choose>
													<c:when test="${node.status==0 }">
														<span style="color:red;"> 未完成 </span>
													</c:when>
													<c:when test="${node.status==1 }">
													已完成
												</c:when>
													<c:otherwise>
													待审批
												</c:otherwise>
												</c:choose>
											</td>
											<td>${node.node_describe }</td>
											<td>${fn:substring(node.node_starttime, 0, 10) }</td>
											<td>${fn:substring(node.node_endtime, 0, 10) }</td>
											<td>V${node.node_version }</td>
											<td>
												<button onclick="getNodeDetail(this.value)"
													value="${node.id }">检查</button>
											</td>
										</tr>
									</c:if>

									<c:if
										test="${sessionScope.user.role.id == 3 and node.firstplan.project.project_manager.id == sessionScope.user.id and node.updateornot == 0}">
										<tr>
											<td>${node.node_id }</td>
											<td>${node.department.dept_name }</td>
											<td><c:choose>
													<c:when test="${node.status==0 }">
														<span style="color:red;"> 未完成 </span>
													</c:when>
													<c:when test="${node.status==1 }">
													已完成
												</c:when>
													<c:otherwise>
													待审批
												</c:otherwise>
												</c:choose>
											</td>
											<td>${node.node_describe }</td>
											<td>${fn:substring(node.node_starttime, 0, 10) }</td>
											<td>${fn:substring(node.node_endtime, 0, 10) }</td>
											<td>V${node.node_version }</td>
											<td>
												<button onclick="getNodeDetail(this.value)"
													value="${node.id }">检查</button>
											</td>
										</tr>
									</c:if>
								</c:forEach>

							</table>
						</c:otherwise>
					</c:choose>
				</div>
			</div>




			<!-- copyright -->



			<jsp:include page="copyright.jsp"></jsp:include>

		</div>
	</div>
	<!-- /#page-wrapper -->
	</div>
	<!-- /#wrapper -->
	<!-- Bootstrap Core JavaScript -->
	<script src="js/bootstrap.min.js"></script>
</body>
</html>
